import request from '@/utils/request'
import { Reward, PaginationParams, PaginationResult } from '@/types'

/**
 * 获取奖励列表
 */
export function getRewardList(params: PaginationParams & { studentId?: number }) {
  return request<PaginationResult<Reward>>({
    url: '/rewards',
    method: 'get',
    params
  })
}

/**
 * 获取学生的所有奖励
 */
export function getStudentRewards(studentId: number) {
  return request<Reward[]>({
    url: `/students/${studentId}/rewards`,
    method: 'get'
  })
}

/**
 * 创建奖励记录
 */
export function createReward(data: Partial<Reward>) {
  return request<Reward>({
    url: '/rewards',
    method: 'post',
    data
  })
}

/**
 * 更新奖励
 */
export function updateReward(id: number, data: Partial<Reward>) {
  return request<Reward>({
    url: `/rewards/${id}`,
    method: 'put',
    data
  })
}

/**
 * 删除奖励
 */
export function deleteReward(id: number) {
  return request({
    url: `/rewards/${id}`,
    method: 'delete'
  })
}

